<template>
    <h2>注册页面</h2>
<table>
    <tr>
        <td>用户名</td>
        <td><input type="text" v-model="info.Uname"></td>
    </tr>
    <tr>
        <td>密码</td>
        <td><input type="password" v-model="info.Upwd"></td>
    </tr>
    <tr>
        <td colspan="2" style="text-align: centers;">
            <input type="button" value="注册" @click="Register">
        </td>
    </tr>
</table>
</template>
<script setup lang="ts">
import axios from 'axios';
import {ref}from 'vue'
const info=ref(
    {
        Uname:"",
        Upwd:""
    }
)
const Register=()=>{
    axios({
    url:"https://localhost:44326/api/Lx/Register",
    method:"post",
    data:{
        UL_Uname:info.value.Uname,
        UL_Upwd:info.value.Upwd
    }
})
.then(res=>{
    if(res.data==-1){
        alert("该账号已被注册")
        return
    }
    else if(res.data>0){
        alert("注册成功")
        location.href="Ulogin"
        return
    }else{
        alert("注册失败")
    }

})
.catch(err=>{
    console.log(err)
})
}





</script>